<template>
  <el-row :gutter="10" class="mb8">
    <el-col :span="1.5">
      <el-button
        type="primary"
        plain
        icon="el-icon-plus"
        size="mini"
        @click="handleAdd"
        v-hasPermi="['pack:container:add']"
      >新增</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="success"
        plain
        icon="el-icon-edit"
        size="mini"
        :disabled="single"
        @click="handleUpdate"
        v-hasPermi="['pack:container:edit']"
      >修改</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="danger"
        plain
        icon="el-icon-delete"
        size="mini"
        :disabled="multiple"
        @click="handleDelete"
        v-hasPermi="['pack:container:remove']"
      >删除</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="warning"
        plain
        icon="el-icon-download"
        size="mini"
        @click="handleExport"
        v-hasPermi="['pack:container:export']"
      >导出</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="info"
        plain
        icon="el-icon-connection"
        size="mini"
        :disabled="single"
        @click="handleBindLocator"
        v-hasPermi="['pack:container:bind']"
      >绑定定位器</el-button>
    </el-col>
    <el-col :span="1.5">
      <el-button
        type="default"
        plain
        icon="el-icon-remove"
        size="mini"
        :disabled="multiple"
        @click="handleUnbindLocator"
        v-hasPermi="['pack:container:unbind']"
      >解绑定位器</el-button>
    </el-col>
    <right-toolbar :showSearch.sync="showSearch" @queryTable="handleRefresh"></right-toolbar>
  </el-row>
</template>

<script>
export default {
  name: 'ContainerToolbar',
  props: {
    single: {
      type: Boolean,
      default: true
    },
    multiple: {
      type: Boolean,
      default: true
    },
    showSearch: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    handleAdd() {
      this.$emit('add')
    },
    handleUpdate() {
      this.$emit('update')
    },
    handleDelete() {
      this.$emit('delete')
    },
    handleExport() {
      this.$emit('export')
    },
    handleBindLocator() {
      this.$emit('bind-locator')
    },
    handleUnbindLocator() {
      this.$emit('unbind-locator')
    },
    handleRefresh() {
      this.$emit('refresh')
    }
  }
}
</script>
